<template>
	<view class="paySuccess">
		<view class="successMsg">
			<view class="sePic">
				<image src="/static/temp/se_icon.png" mode=""></image>
			</view>
			<view class="sameStyle" style="color:#888;font-size: 24upx;">
				支付成功
			</view>
			<view class="" v-if="money">
				<view class="sameStyle" style="color:#ff9600;font-size: 28upx;letter-spacing: 5upx;font-weight: bold;">
					订单金额：￥{{money.orderPay}}
				</view>
			</view>
			<view class="" v-else>
				<view class="sameStyle" style="color:#ff9600;font-size: 28upx;letter-spacing: 5upx;font-weight: bold;">
					恭喜您在纳芈汇
				</view>
				<view class="sameStyle" style="color:#ff9600;font-size:30upx;font-weight: bold;">
					升级成功
				</view>
			</view>
		</view>
		<view class="btnBack">
			<view class="backMsg colorBack" style="float: left;" @click="backShop">
				返回商城首页
			</view>
			<view class="backMsg" style="background-color:#63d57d;float: right;" @click="backMember">
				返回会员中心
			</view>
		</view>
	</view>
</template>

<script>
	import {mapState,mapMutations} from 'vuex';
	export default {
		data() {
			return {
				money:null
			};
		},
		onLoad(options){
			if(options.payMoney){
				this.money = JSON.parse(option.payMoney);
			}
			this.init();
		},
		methods:{
			...mapMutations(['login']),
			init(){
				let userInfo = uni.getStorageSync('userInfo');
				uni.request({
					url: this.$base_url + '/member/memberInfo',
					data: {},
					header: {
						"Content-Type": "application/x-www-form-urlencoded",
						"token": userInfo.token,
					},
					method: "POST",
					success: (res) => {
						if (res.data.code == 10000) {
							let userInfo = this.$store.state.userInfo;
							let myInfo = res.data.data.member_info;
							if (myInfo) {								
								userInfo.member_level=myInfo.member_level
								this.login(userInfo);
							}
						} else if (res.data.code == 40001) {
							this.$api.msg(res.data.message);
						} else {
							this.$api.msg(res.data.message);
							this.logining = false;
						}
						this.loading = true;
					},
					fali: (res) => {
						console.log(res.data);
					}
							
				});
			},
			backShop(){
				uni.switchTab({
				    url: '/pages/index/index'
				});
			},
			backMember(){
				uni.switchTab({
				    url: '/pages/home/home'
				});
			}
		}
	}
</script>

<style lang="scss">
@import './paySuccess.scss'
</style>
